package SingletonPattern;

/**
 * @Author: zhaojie
 * @Date: Created in 10:48 2018/6/26
 * @Description: 双检锁/双重校验锁（DCL，即 double-checked locking）
 */
public class SingleDCL {

    private volatile static SingleDCL singleDCL;

    private SingleDCL() {
    }

    public static SingleDCL getSingleDCL() {
        if (singleDCL == null) {
            synchronized (SingleDCL.class) {
                if (singleDCL == null) {
                    singleDCL = new SingleDCL();
                }
            }
        }
        return singleDCL;
    }
}
